package com.easybuilder.core.seo.service.impl;

import com.alibaba.fastjson.JSONObject;

import com.easybuilder.core.seo.service.AbstractSeoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@Slf4j
@Service
public class BaiduSeoService extends AbstractSeoService {

    @Value("${seo_baidu_url}")
    private String seo_baidu_url;
    @Resource
    private RestTemplate restTemplate;

    @Override
    public void push(String url) {
        log.info("推送至百度收录地址：{}", url);
        JSONObject result = restTemplate.postForObject(seo_baidu_url, url, JSONObject.class);
        log.info("推送至百度收录结果：{}", result.toJSONString());
    }

}
